/*
* Copyright 2013 Trend Micro Incorporated
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef _TLSH_IMPL_H
#define _TLSH_IMPL_H
#define BUCKETS_256  
#define SLIDING_WND_SIZE  5
#define BUCKETS           256
#define Q_BITS            2    // 2 bits; quartile value 0, 1, 2, 3

// BUCKETS_256 & CHECKSUM_3B are compiler switches defined in CMakeLists.txt

#if defined BUCKETS_256
#define EFF_BUCKETS         256
#define CODE_SIZE           64   // 256 * 2 bits = 64 bytes
#if defined CHECKSUM_3B
#define TLSH_CHECKSUM_LEN 3
// defined in tlsh.h   #define TLSH_STRING_LEN   138  // 2 + 3 + 64 bytes = 138 hexidecimal chars
#else
#define TLSH_CHECKSUM_LEN 1
// defined in tlsh.h   #define TLSH_STRING_LEN   134  // 2 + 1 + 64 bytes = 134 hexidecimal chars
#endif
#else
#define EFF_BUCKETS         128
#define CODE_SIZE           32   // 128 * 2 bits = 32 bytes
#if defined CHECKSUM_3B
#define TLSH_CHECKSUM_LEN 3
// defined in tlsh.h   #define TLSH_STRING_LEN   74   // 2 + 3 + 32 bytes = 74 hexidecimal chars
#else
#define TLSH_CHECKSUM_LEN 1
// defined in tlsh.h   #define TLSH_STRING_LEN   70   // 2 + 1 + 32 bytes = 70 hexidecimal chars
#endif
#endif


void update1(const unsigned char* data, unsigned int len);
void final1();

void update1test(unsigned char* data, unsigned int len);
void final1test();
void reset();
char* hash1();

int totalDiff(int len_diff);

char* hash1(char *buffer, unsigned int bufSize);  // saves allocating hash string in TLSH instance - bufSize should be TLSH_STRING_LEN + 1
//int compare(const TlshImpl& other) ;

char* hash1test(char *buffer, unsigned int bufSize);
// int totalDiff(unsigned char other, int len_diff );
int fromTlshStr_impl(const char* str);
//int isValid() const { return lsh_code_valid; }





#endif

